using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MeetingRoom.Domain;
using MeetingRoom.Support;
using NHibernate;

namespace MeetingRoom.Data.Implementation
{
    public class ScheduleCreate : ICreate
    {
        protected IDbConnection connection = null;

        protected IGetMeetingRoomTypeBySize query = null;

        public IGetMeetingRoomTypeBySize QueryImplementor
        {
            set
            {
                this.query = value;
            }
        }

        public IDbConnection Connection
        {
            set { this.connection = value; }
        }

        public void Create(object obj)
        {
            Assert.IsNotNull(obj, "MeetingRoom cannot be null");
            Assert.IsType(obj, typeof(MeetingRoom.Domain.ScheduleRequest));

            ScheduleRequest scheduleRequest = (ScheduleRequest)obj;
            Schedule schedule = new Schedule();
            schedule.Name = scheduleRequest.Name;
            schedule.Applicant = scheduleRequest.Applicant;
            schedule.MeetingRoomType = this.query.GetMeetingRoomTypeBySizeBySize(scheduleRequest.Size);
            schedule.Status = ScheduleStatus.PENDING;

            string insert = "insert into t_schedule (schedule_id, name, [begin], [end], status) values(@ScheduleId, @Name, @Begin, @End, @Status";

        }
    }
}
